cc		=	gcc
cflags	=	-O2 -Wall -Wno-pointer-sign
clibs	=	-lpthread -latomic -ldl

all: jinshu

jianshu_src = main.c accept.c handle.c check.c output.c global_var.c config_db.c ans_code.c mail_fmt.c
jianshu_o = socket.o cas_queue.o jthreads.o sqlite3.o murmur3.o base64.o

jinshu: $(jianshu_src) $(jianshu_o)
	$(cc)  $(cflags) -o $@ $^ $(clibs)

jthreads.o: jthreads.c
	$(cc) $(cflags) -c -o $@ $^

cas_queue.o: cas_queue.c
	$(cc) $(cflags) -c -o $@ $^

socket.o: socket.c
	$(cc) $(cflags) -c -o $@ $^

sqlite3.o: ../contrib/sqlite3/sqlite3.c
	$(cc) $(cflags) -c -o $@ $^

murmur3.o: ../contrib/murmur3/murmur3.c
	$(cc) $(cflags) -c -o $@ $^

base64.o: ../contrib/base64/base64.c
	$(cc) $(cflags) -c -o $@ $^

clean:
	-rm *.o
	-rm jinshu
